trigger CalculateEDC on Opportunity (before insert,before update) {

    EDCCalculationController calculateedc=new EDCCalculationController();
    
    list<Opportunity> lstOpps = trigger.new;
    
    if(trigger.Isbefore && trigger.Isinsert){
        calculateedc.CheckforActiveOpp(lstOpps,'Insert');
        calculateedc.CalculateEDCbeforeinsert(lstOpps );
    }
    if(trigger.Isbefore && trigger.Isupdate){
        
        calculateedc.CheckforActiveOpp(lstOpps,'Update');
       
        calculateedc.CalculateEDC(lstOpps ,trigger.oldmap);
       
        
    }       
}